Skip to main content

Network Security

Network security in system design refers to the strategies, practices, and technologies implemented to protect the integrity, confidentiality, and availability of data as it travels across networks — between clients, services, databases, and external systems.

When designing a system, network security focuses on preventing unauthorized access, data breaches, and attacks (like DDoS, MITM, etc.) by embedding security controls at every network layer.

Key Goals of Network Security

GoalDescription
ConfidentialityEnsure data is only accessible to authorized users/systems
IntegrityEnsure data is not altered or tampered with during transmission
AvailabilityEnsure the network and services are available when needed
AuthenticationVerify the identity of users and systems
Access ControlDefine and enforce rules for who can access what resources

Network Security Layers

  1. Perimeter Security: Firewalls, API gateways, VPNs
  2. Transport Security: TLS/SSL encryption
  3. Application-Level Security: Authentication tokens, input validation
  4. Internal Network Segmentation: VPCs, subnets, private IP spaces
  5. Monitoring & Logging: Intrusion Detection/Prevention Systems (IDS/IPS), log analyzers

Security Mechanisms

MechanismPurpose
TLS/SSLEncrypt data in transit (e.g., HTTPS)
FirewallAllow or deny network traffic based on rules
API GatewayEnforces rate limiting, auth, logging, and routing
IDS/IPSDetects and blocks suspicious activities
VPNSecure communication over public networks
WAF (Web Application Firewall)Filters traffic to web apps, blocks SQLi, XSS
Network SegmentationSeparates sensitive services into private subnets
Reverse ProxyHides backend services and adds a security buffer

Example of Network Security

Design a secure system for a healthcare provider that includes:

  • Patient mobile app
  • Doctor portal
  • Backend services for scheduling, medical records
  • Database storing patient data
          [Internet]

┌───────▼────────┐
│ API Gateway │ ← WAF + TLS + Rate Limit
└───────▲────────┘

┌─────────┴────────────┐
│ Load Balancer │ ← DDoS protection
└───────▲──────────────┘

┌─────────────┴─────────────┐
│ Backend Services │ ← Private subnet (not exposed to public)
│ ┌───────────────────────┐ │
│ │ Scheduling Service │ │
│ │ Medical Record Service │ │
│ └───────────────────────┘ │
└─────────────▲─────────────┘

┌────────┴────────┐
│ Database (DB) │ ← Encrypted, private access only
└─────────────────┘

[Authentication Server]
↕ Token-based Auth (OAuth2)

[Monitoring System]
↕ Network logs, alerts, anomaly detection

Network Security Design Decisions

DecisionExplanation
TLS EverywhereEnsures data in transit (medical records, credentials) is encrypted
Private SubnetsBackend and DB are hidden from public internet
Firewall RulesOnly API Gateway and Auth Server can access backend services
WAF on API GatewayBlocks SQL injection, XSS, bad bots
DDoS Protection on Load BalancerProtects from high-volume attack attempts
VPN Access for AdminsSecure remote access to internal systems
Monitoring & AlertsDetects intrusions or unusual traffic in real time

Common Network Security Threats

ThreatExampleMitigation
Man-in-the-Middle (MITM)Intercepting login dataUse HTTPS (TLS)
DDoSFlooding system with trafficUse rate limiting, load balancing, CDNs
SQL Injection over APIMalicious query stringsUse WAF, input validation
Unauthorized AccessDirect DB access from webVPCs, IAM, firewall rules
Data LeakageSensitive data in logsMask PII, encrypt logs, RBAC

Best Practices for Network Security

  • Use HTTPS by default on all endpoints.
  • Segment the network using VPCs and subnets.
  • Block all unused ports and protocols.
  • Use IAM roles instead of hardcoded credentials.
  • Monitor continuously and set up automated alerts.
  • Design systems with a zero-trust mindset.